﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using GodPl.WorldState;

namespace GodPl.GameObjects
{
   
    public enum Side { Top, Right, Bottom, Left }

    public class Wall : GameObject, IObstacle
    {

        ObstacleGravityType gravityType;

        static Vector2 WallLocation(Side side)
        {
            int x = 0;
            int y = 0;

            switch (side)
            {
                case Side.Top:
                    x = GodPlGame.ScreenWidth / 2;
                    y = 0;
                    break;
                case Side.Bottom:
                    x = GodPlGame.ScreenWidth / 2;
                    y = GodPlGame.ScreenHeight;
                    break;
                case Side.Left:
                    x = 0;
                    y = GodPlGame.ScreenHeight / 2;
                    break;
                case Side.Right:
                    x = GodPlGame.ScreenWidth;
                    y = GodPlGame.ScreenHeight / 2;
                    break;
            }

            return new Vector2((float)x, (float)y);
        }

        public Wall(World world, Side side) : base(world, WallLocation(side))
        {
            if (side == Side.Left || side == Side.Right)
            {
                gravityType = ObstacleGravityType.Vertical;
                this.localBounds.Height = GodPlGame.ScreenHeight;
                this.localBounds.Width = 4;
            }

            if (side == Side.Bottom || side == Side.Top)
            {
                gravityType = ObstacleGravityType.Horizontal;
                this.localBounds.Height = 4;
                this.localBounds.Width = GodPlGame.ScreenWidth;
            }
        }


        public override void LoadContent()
        {
            // Nothing to do here
        }

        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            // Nothing
        }

        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            // Nothing
        }

        #region IObstacle Members

        public ObstacleGravityType GravityType
        {
            get { return gravityType; }
        }

        #endregion
    }
}
